#include "flash_hal.h"
#include "string.h"
#include "lks32MC08x_flash.h"
#include "adc_hal.h"
#include "can_hal.h"
//struct flash_dev flash_device_hal;
/**********FLASH操作类型地址选择*********/
#define Flash_MAIN_NVR Flash_NVR //Flash_MAIN 或 Flash_NVR

#if !Flash_MAIN_NVR
#define Flash_ADDR 0x000A000 //实验MAIN首地址
#else
#define Flash_ADDR 0x0000000 //实验NVR首地址
#endif


void flash_hal_write_allpage(uint8_t *buf,uint16_t size)
{
			erase_flag = 0x9A0D361F;				
			EraseSector(Flash_ADDR, Flash_MAIN_NVR); 
			progm_flag = 0x9AFDA40C; 
			ProgramPage(Flash_ADDR, size/4, buf, Flash_MAIN_NVR);

}
/**
 * @brief 读取flash内容
 * 
 * @param buf 
 * @param len 
 */

void flash_hal_read_all(uint8_t *buf,uint32_t len)
{
		Read_More_Flash(Flash_ADDR,len/16,(uint32_t*)buf, Flash_MAIN_NVR);
}


